/*
 * @Author: wei_jt@ecidi.com
 * @Date: 2020-07-07 14:05:26
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-09-01 11:20:59
 * @Description: 组织架构
 */
import request from '@/utils/request'
//获取组织架构树
export function getOrgs (portalId) {
  return request({
    url: '/sys-user/orgs/tree',
    method: 'get',
    params: {
      isAll: false,
      portalId: portalId,
      needMemberNum: true
    }
  })
}
//获取组织机构下人员
export function getUser (params) {
  return request({
    url: '/sys-user/org/users',
    method: 'get',
    params: params
  })
}
//获取组织机构下人员分页
export function getUserList (params) {
  return request({
    url: '/sys-user/v2/users/page',
    method: 'get',
    params: params
  })
}
//新增
export function addOrg (data) {
  return request({
    url: '/sys-user/org',
    method: 'post',
    data: data,
  })
}

//修改
export function modifyOrg (data) {
  return request({
    url: '/sys-user/org',
    method: 'put',
    data: data,
  })
}

//删除
export function deleteOrg (id) {
  return request({
    url: '/sys-user/org',
    method: 'delete',
    params: { id }
  })
}
//更新门户
export function updatePortal (data) {
  return request({
    url: '/sys-user/portal',
    method: 'put',
    data: data
  })
}

export function updateOrgMember (data) {
  return request({
    url: '/sys-user/org/users',
    method: 'put',
    data: data
  })
}

//导出部门
export function exportOrg (data) {
  return request({
    url: '/sys-user/orgs/export',
    method: 'post',
    responseType: 'blob',
    data: data
  })
}
